﻿using Tp.GeschaeftsfaelleViewModel;
using Tp.Interfaces;
using Tp.Interfaces.Commands;
using Tp.Interfaces.Commands.BusinessCases;
using Tp.Interfaces.Commands.Projects;
using Tp.Interfaces.Commands.Stammdaten;
using Tp.Interfaces.Services;
using Tp.Interfaces.ViewModels;
using Tp.Interfaces.ViewModels.BusinessCases;
using Tp.Interfaces.ViewModels.Projects;
using Tp.Interfaces.ViewModels.Stammdaten;
using Tp.MainViewModel;
using Tp.ProjekteViewModel;
using Tp.Services;
using Tp.StammdatenViewModel;
using Tp.TreeViewModel;
using Tp.ViewModelLocator;


namespace Tp.Bootstrapper
{
	  public static class IoC
	  {
			public static IUnityServiceLocator ServiceLocator
			{
				  get { return IoCUnityServiceLocator.Locator; }
			}

			public static void InitializeUnityContainer()
			{
				  SetServiceLocator();
				  RegisterInterfaces();
			}

			private static void SetServiceLocator()
			{
				  IoCUnityServiceLocator.SetServiceLocatorProvider(new UnityServiceLocator());
			}

			private static void RegisterInterfaces()
			{
				  // zuerst kommt der ViewModelLocator
				  // er kümmert sich um die Konstruktion des view models
				  #region ViewModelLocator

				  ServiceLocator.Register<IViewModelLocator, ViewModelLocator.ViewModelLocator>();

				  #endregion

				  #region ViewModels

				  #region BusinessCases

				  ServiceLocator.Register<IAnfragenUserControlViewModel, AnfragenUserControlViewModel>();
				  ServiceLocator.Register<IVerkaufUserControlViewModel, VerkaufUserControlViewModel>();
				  ServiceLocator.Register<IKundenUserControlViewModel, KundenUserControlViewModel>();
				  ServiceLocator.Register<IVerlorenUserControlViewModel, VerlorenUserControlViewModel>();

				  #endregion

				  #region Projects

				  ServiceLocator.Register<IEmployeeUserControlViewModel, EmployeeUserControlViewModel>();

				  #endregion

				  #region Stammdaten

				  ServiceLocator.Register<IOrganisationUserControlViewModel, OrganisationUserControlViewModel>();
                  ServiceLocator.Register<IPersonenUserControlViewModel, PersonenUserControlViewModel>();

				  #endregion

				  ServiceLocator.Register<IMainWindowViewModel, MainWindowViewModel>();
				  ServiceLocator.Register<ITreeViewUserControlViewModel, TreeViewUserControlViewModel>();
				  ServiceLocator.Register<IGeschaeftsfaelleUserControlViewModel, GeschaeftsfaelleUserControlViewModel>();
				  ServiceLocator.Register<IProjekteUserControlViewModel, ProjekteUserControlViewModel>();
				  
				  #endregion

				  #region Commands

				  #region BusinessCases

				  ServiceLocator.Register<IAnfragenViewModelCommands, AnfragenViewModelCommands>();
				  ServiceLocator.Register<IVerkaufViewModelCommands, VerkaufViewModelCommands>();
				  ServiceLocator.Register<IKundenViewModelCommands, KundenViewModelCommands>();
				  ServiceLocator.Register<IVerlorenViewModelCommands, VerlorenViewModelCommands>();

				  #endregion

				  #region Projects

				  ServiceLocator.Register<IEmployeeViewModelCommands, EmployeeViewModelCommands>();

				  #endregion

				  #region Stammdaten

				  ServiceLocator.Register<IOrganisationViewModelCommands, OrganisationViewModelCommands>();
                  ServiceLocator.Register<IPersonenViewModelCommands, PersonenViewModelCommands>();

				  #endregion

				  ServiceLocator.Register<IMainViewModelCommands, MainViewModelCommands>();
				  ServiceLocator.Register<IGeschaeftsfaelleViewModelCommands, GeschaeftsfaelleViewModelCommands>();
				  ServiceLocator.Register<ITreeViewModelCommands, TreeViewModelCommands>();
				  ServiceLocator.Register<IProjekteViewModelCommands, ProjekteViewModelCommands>();

				  #endregion

				  #region Services
				  
				  ServiceLocator.Register<IEmployeeService, EmployeeService>();
                  ServiceLocator.Register<IOrganisationService, OrganisationService>();
				  ServiceLocator.Register<IPersonenService, PersonenService>();

				  #endregion

				  #region Dialogs

				  #endregion
			}

	  }
}
